home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / database / hl / hl-1.000 / hl-1 / TkInterface / tkAppInit.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-21  |  3.1 KB  |  105 lines

  1. /* 
  2.  * tkAppInit.c --
  3.  *
  4.  *    Provides a default version of the Tcl_AppInit procedure for
  5.  *    use in wish and similar Tk-based applications.
  6.  *
  7.  * Copyright (c) 1993 The Regents of the University of California.
  8.  * All rights reserved.
  9.  *
  10.  * Permission is hereby granted, without written agreement and without
  11.  * license or royalty fees, to use, copy, modify, and distribute this
  12.  * software and its documentation for any purpose, provided that the
  13.  * above copyright notice and the following two paragraphs appear in
  14.  * all copies of this software.
  15.  * 
  16.  * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
  17.  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
  18.  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  19.  * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  20.  *
  21.  * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  22.  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  23.  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  24.  * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  25.  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  26.  */
  27.  
  28. #ifndef lint
  29. static char rcsid[] = "$Header$";
  30. #endif /* not lint */
  31.  
  32. #include "tclExtend.h"
  33. #include "tk.h"
  34. #include "tkX.h"
  35.  
  36.  
  37.  
  38. extern int TkvBTree_Init(Tcl_Interp *interp);
  39. extern int TkCardRecord_Init(Tcl_Interp *interp);
  40. /*extern int TkListRecord_Init(Tcl_Interp *interp);*/
  41.  
  42. /*
  43.  *----------------------------------------------------------------------
  44.  *
  45.  * Tcl_AppInit --
  46.  *
  47.  *    This procedure performs application-specific initialization.
  48.  *    Most applications, especially those that incorporate additional
  49.  *    packages, will have their own version of this procedure.
  50.  *
  51.  * Results:
  52.  *    Returns a standard Tcl completion code, and leaves an error
  53.  *    message in interp->result if an error occurs.
  54.  *
  55.  * Side effects:
  56.  *    Depends on the startup script.
  57.  *
  58.  *----------------------------------------------------------------------
  59.  */
  60.  
  61. int
  62. Tcl_AppInit(Tcl_Interp *interp)
  63. {
  64.     Tk_Window main;
  65.  
  66.     main = Tk_MainWindow(interp);
  67.  
  68.     /*
  69.      * Call the init procedures for included packages.  Each call should
  70.      * look like this:
  71.      *
  72.      * if (Mod_Init(interp) == TCL_ERROR) {
  73.      *     return TCL_ERROR;
  74.      * }
  75.      *
  76.      * where "Mod" is the name of the module.
  77.      */
  78.  
  79.     if (TclX_Init(interp) == TCL_ERROR) {
  80.     return TCL_ERROR;
  81.     }
  82.     if (TkX_Init(interp) == TCL_ERROR) {
  83.     return TCL_ERROR;
  84.     }
  85.  
  86.     (void) TkvBTree_Init(interp);
  87.     (void) TkCardRecord_Init(interp);
  88.     /*(void) TkListRecord_Init(interp);*/
  89.      
  90.     /*
  91.      * Call Tcl_CreateCommand for application-specific commands, if
  92.      * they weren't already created by the init procedures called above.
  93.      */
  94.  
  95.     /*
  96.      * Specify a user-specific startup file to invoke if the application
  97.      * is run interactively.  Typically the startup file is "~/.apprc"
  98.      * where "app" is the name of the application.  If this line is deleted
  99.      * then no user-specific startup file will be run under any conditions.
  100.      */
  101.  
  102.     tcl_RcFileName = "~/.wishrc";
  103.     return TCL_OK;
  104. }
  105.